package com.hp.ongoing.persistence.exception;

import java.sql.SQLException;

import com.hp.ongoing.util.Constantes;

public class DataBaseAcessException extends SQLException {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = -5208975212493430312L;

	private String msg;	
	
	
	public DataBaseAcessException(String msg, Integer vendorErrorCode) {
		super(msg,null,vendorErrorCode);
		this.msg = msg;
		this.vendorErrorCode = vendorErrorCode;
	}

	private Integer vendorErrorCode;
	
	private String getMessageUser(Integer vendorErrorCode){
		String m = "";
		if(vendorErrorCode == 1017)
			m = Constantes.ERRO_CONEXAO;
		return m;
	}
	
	public String getMsg() {
		if (vendorErrorCode != null)
			msg = getMessageUser(vendorErrorCode);
		return msg;		
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public Integer getVendorErrorCode() {
		return vendorErrorCode;
	}

	public void setVendorErrorCode(Integer vendorErrorCode) {
		this.vendorErrorCode = vendorErrorCode;
	}
	

}
